// src/components/QuestionEditor/TextInput.jsx
import React from 'react';
import { Input, Select } from 'antd';

const validationTypes = [
  { label: '无验证', value: 'none' },
  { label: '邮箱', value: 'email' },
  { label: '手机号', value: 'phone' },
  { label: '数字', value: 'number' }
];

const TextInput = ({ question, updateQuestion }) => {
  const handleValidationChange = (value) => {
    updateQuestion({ ...question, validation: value });
  };

  return (
    <div>
      <Input.TextArea
        placeholder="示例文本"
        disabled
        style={{ marginBottom: 8 }}
      />
      <Select
        value={question.validation || 'none'}
        onChange={handleValidationChange}
        style={{ width: 200 }}
        options={validationTypes}
      />
    </div>
  );
};

export default TextInput;